public class PathPatternParser
extends java.lang.Object
PathPattern
instances that can
then be matched to requests.
The PathPatternParser
and PathPattern
are specifically
designed for use with HTTP URL paths in web applications where a large number
of URI path patterns, continuously matched against incoming requests,
motivates the need for efficient matching.
For details of the path pattern syntax see PathPattern
.
Modifier and Type | Field and Description |
---|---|
private boolean |
caseSensitive |
private boolean |
matchOptionalTrailingSeparator |
Constructor and Description |
---|
PathPatternParser() |
Modifier and Type | Method and Description |
---|---|
(package private) char |
getSeparator()
Accessor used for the separator to use.
|
boolean |
isCaseSensitive()
Whether case-sensitive pattern matching is enabled.
|
boolean |
isMatchOptionalTrailingSeparator()
Whether optional trailing slashing match is enabled.
|
PathPattern |
parse(java.lang.String pathPattern)
Process the path pattern content, a character at a time, breaking it into
path elements around separator boundaries and verifying the structure at each
stage.
|
void |
setCaseSensitive(boolean caseSensitive)
Whether path pattern matching should be case-sensitive.
|
void |
setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator)
Whether a
PathPattern produced by this parser should should
automatically match request paths with a trailing slash. |
private boolean matchOptionalTrailingSeparator
private boolean caseSensitive
public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator)
PathPattern
produced by this parser should should
automatically match request paths with a trailing slash.
If set to true
a PathPattern
without a trailing slash
will also match request paths with a trailing slash. If set to
false
a PathPattern
will only match request paths with
a trailing slash.
The default is true
.
public boolean isMatchOptionalTrailingSeparator()
public void setCaseSensitive(boolean caseSensitive)
The default is true
.
public boolean isCaseSensitive()
char getSeparator()
Currently not exposed for configuration with URI path patterns and
mainly for use in InternalPathPatternParser and PathPattern. If required
in the future, a similar option would also need to be exposed in
PathContainer
.
public PathPattern parse(java.lang.String pathPattern) throws PatternParseException
InternalPathPatternParser
because that class is not thread-safe.pathPattern
- the input path pattern, e.g. /foo/{bar}PatternParseException
- in case of parse errors